package facelets.component;

import org.apache.myfaces.custom.popup.HtmlPopup;

import com.sun.facelets.tag.jsf.ComponentConfig;
import com.sun.facelets.tag.jsf.ComponentHandler;

public class PopupComponentHandler extends ComponentHandler { // NO_UCD
			
	public PopupComponentHandler(ComponentConfig cfg) {
		super(cfg);
	}
	

	
	/* (non-Javadoc)
	 * @see com.sun.facelets.tag.MetaTagHandler#setAttributes(com.sun.facelets.FaceletContext, java.lang.Object)
	 */
	public void setAttributes(com.sun.facelets.FaceletContext ctx, Object instance) {
		HtmlPopup popup = (HtmlPopup) instance;
		if ( getAttribute ("styleClass") == null )
			popup.setStyleClass("popup");
		if ( getAttribute ("closePopupOnExitingElement") == null )
			popup.setClosePopupOnExitingElement(true);
		if ( getAttribute ("closePopupOnExitingPopup") == null )
			popup.setClosePopupOnExitingPopup(true);
		
		if ( getAttribute ("displayAtDistanceX") == null )
			popup.setDisplayAtDistanceX(10);
		if ( getAttribute ("displayAtDistanceY") == null )
			popup.setDisplayAtDistanceY(10);
		
		
		super.setAttributes(ctx, instance);
	}
}